docs(plugin-auth,client): 两处仓内文档不再把四条不存在的 auth 端点写成已注册路由 (#5772) - #5823
Merged
Conversation
`IMPLEMENTATION_SUMMARY.md` 的 "API Routes Registered" 节列的 `POST /api/v1/auth/login` / `register` / `logout` / `GET .../session` 四条端点 一条都不存在:auth 插件用单条 catch-all 把 `/api/v1/auth/*` 整体转发给 better-auth,真实路由表由 `src/auth-route-ledger.ts`(#3656)逐条枚举并由 conformance 测试对活的 `auth.api` 校验。该节改为指向台账这一单一事实源,只保 留四条核心路由的真名作最小示例(与 `content/docs/api/plugin-endpoints.mdx` 一致),并写明这四个名字不存在、唯一让 `/auth/login` 看起来可达的遗留显式挂载 已在 #5085 删除。同文件 "Core Plugin Implementation" 里同一处虚假声明一并改正。 `CLIENT_SERVER_INTEGRATION_TESTS.md` 的 MSW 示例改用真实端点 `POST /api/v1/auth/sign-in/email`,并注明四个 SDK 方法各自打到哪条路由、台账 在哪 —— 照抄旧示例写出的测试会打在一个 404 上。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JwwiU9bjhwy2SWj13ho8uv
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
📓 Docs Drift CheckThis PR changes 2 package(s): 21 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:
|
baozhoutao
marked this pull request as ready for review
August 6, 2026 06:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5772
docs-only, skip-changeset requested(两份仓内开发文档,发布不可见,无 changeset)。
前提复核(改前对 origin/main 实读)
issue 的前提成立,两处都还在
a3a884d7a(当时的origin/main)上:packages/plugins/plugin-auth/IMPLEMENTATION_SUMMARY.md:89-94—— 标题就是 "API Routes Registered",列POST /api/v1/auth/login/register/logout与GET /api/v1/auth/session;packages/client/CLIENT_SERVER_INTEGRATION_TESTS.md:642—— MSW 示例rest.post('/api/v1/auth/login', …)。四条端点确实一条都不存在,逐条核对了三个独立事实源:
packages/plugins/plugin-auth/src/auth-route-ledger.ts(Enumerate the/auth/**dynamic route family — 54 SDK methods rest on a prefix claim, not a route #3656)逐条枚举 55 条 SDK 可达路由 + 完整 mounted inventory,四个名字零命中;真名分别是POST /api/v1/auth/sign-in/email(auth.login)、POST /api/v1/auth/sign-up/email(auth.register)、POST /api/v1/auth/sign-out(auth.logout)、GET /api/v1/auth/get-session(auth.me)。packages/client/src/index.ts:2109-2170的 SDK 实现打的就是这四条真名(login注释即 "Uses better-auth endpoint: POST /sign-in/email")。packages/plugins/plugin-auth/src/auth-plugin.ts:2109是单条 catch-allrawApp.all(${basePath}/*)整体转发给 better-auth,前面另挂了 ObjectStack 自有的/config、/bootstrap-status、/admin/*等;没有任何login/register/logout/session显式路由。改动
IMPLEMENTATION_SUMMARY.md:整节改名为 "API Routes",采纳 issue 的防再漂建议 —— 指向src/auth-route-ledger.ts这一单一事实源(并说明台账由auth-route-ledger.conformance.test.ts对活的auth.api表校验),只保留四条核心路由的真名作最小示例,端点名与content/docs/api/plugin-endpoints.mdx完全一致;末尾明写这四个旧名字不存在,唯一让/auth/login看起来可达的遗留显式挂载在 runtime dispatcher 里、对任何调用方都只 500、已在 #5085 删除。手抄整表会再漂,指向台账不会 —— 被删掉的那一节本身就是证据。同文件
:35的 "Route registration - HTTP endpoints for login, register, logout, session" 是同一处虚假声明的另一种拼写(同一文件、同一缺陷,属本 issue 面),一并改为「auth base path 整体转发给 better-auth」并链到上面那节。CLIENT_SERVER_INTEGRATION_TESTS.md:MSW 示例改用真实端点POST /api/v1/auth/sign-in/email,注释里写清四个 SDK 方法各自打到哪条路由、台账文件在哪。示例的响应体未动({ success, data: { token, user, expiresAt } })—— 那不是本 issue 的判读面,且 SDK 的login对data包封与 better-auth 的顶层{ token, user }两种形状都做归一(index.ts:2131),示例照旧可用。验收:改后
git grep的逐条判定git grep -n "api/v1/auth/login" -- '*.md'改后剩两条,均判定为框定正确、留:.changeset/auth-unknown-subpath-clean-404.md:10POST /api/v1/auth/login出现在实测输出块里,正文明写该路由「could not work for any caller」「It is deleted」。这是在记录一条被删除的路由,不是声称它存在 —— 留。packages/plugins/plugin-auth/IMPLEMENTATION_SUMMARY.md:116放宽到
git grep -n "auth/login" -- '*.md' '*.mdx',另外三条同样留:content/docs/api/plugin-endpoints.mdx:18("There is no/auth/loginroute",本来就是对的)、CLIENT_SERVER_INTEGRATION_TESTS.md:641(本 PR 新写的否定注释)、packages/plugins/plugin-auth/ARCHITECTURE.md:74(实读确认:74与:79都在 "#### Before (Manual Approach)" 代码块内,下面紧接 "#### After (Direct Forwarding)" 的 wildcard 写法,框定正确 —— issue 已论证不改,本 PR 未动)。git grep -nE "auth/(register|logout|session)" -- '*.md' '*.mdx'的其余命中全部是 CHANGELOG/changeset 里 #4251 的「auth/session slot lookups」,指服务槽位不是路由,非本类。验证
纯 markdown,无代码面、无测试面。跑的是与改动面相关的门:
另核对了两条新增相对链接在磁盘上都解析得到:
./src/auth-route-ledger.ts、../../../content/docs/api/plugin-endpoints.mdx。关联:#5085(发现现场)、#3656(auth 路由台账的来源)。
Generated by Claude Code